home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-27 | 1.8 KB | 82 lines | [TEXT/KAHL] |
- // -----------------------------------------------------------------------------
- // File : demoButtons.c
- // Date : June 18, 1995
- // Author : Jim Stout
- // Purpose : show use of 'cctb' resource to colorize push buttons
- // :
- // -----------------------------------------------------------------------------
-
- #include "demoDialog.h"
- #include "movableModal.h"
-
- extern void demoButtons()
- {
- DialogPtr theDialog;
- short itemHit,t,i,val;
- Rect r;
- ControlHandle h=0,h2=0;
- Boolean on=true;
-
- theDialog = GetNewDialog(220,0L,(DialogPtr)-1);
- if(theDialog) {
- SetPort(theDialog);
-
- TextFont(courier);
- TextSize(12);
- ShowWindow(theDialog);
-
- do {
- movableModalDialog(nil,&itemHit);
- switch(itemHit) {
- case 3:
- for(i=1;i<=12;i++ ) {
- if(i == 2 || i == 3)
- continue;
- GetDItem(theDialog, i, &t, (Handle *)&h, &r);
- if(on)
- HiliteControl(h, 0xFF);
- else
- HiliteControl(h, 0);
- }
- on = !on;
- GetDItem(theDialog, 3, &t, (Handle *)&h, &r);
- if(on)
- SetControlTitle(h, "\pDisable");
- else {
- SetControlTitle(h, "\pEnable");
- GetDItem(theDialog, 12, &t, (Handle *)&h, &r);
- SetControlValue(h, 0);
- }
- break;
- case 10:
- case 11:
- GetDItem(theDialog, 10, &t, (Handle *)&h, &r);
- GetDItem(theDialog, 11, &t, (Handle *)&h2, &r);
- if(itemHit == 10) {
- SetControlValue(h, 1);
- SetControlValue(h2, 0);
- }
- else {
- SetControlValue(h, 0);
- SetControlValue(h2, 1);
- }
- break;
- case 12:
- GetDItem(theDialog, 12, &t, (Handle *)&h, &r);
- val = GetControlValue(h);
- SetControlValue(h, !val);
- for(i=4;i<=9;i++) {
- GetDItem(theDialog, i, &t, (Handle *)&h, &r);
- if(val)
- HiliteControl(h, 0);
- else
- HiliteControl(h, inButton);
- }
- break;
- }
- }while(itemHit != 1);
- DisposDialog(theDialog);
- }
- }
-
-